package cn.wps.moffice.main.push.common; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; import android.net.Uri; import android.net.http.SslError; import android.os.Build; import android.os.Bundle; import android.support.v4.app.NotificationCompat; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.DownloadListener; import android.webkit.SslErrorHandler; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ImageView; import cn.wps.moffice.OfficeApp; import cn.wps.moffice.common.beans.MaterialProgressBarCycle; import cn.wps.moffice.common.beans.OnResultActivity; import cn.wps.moffice.common.beans.webview.KWebChromeClient; import cn.wps.moffice.common.superwebview.WebviewErrorPage; import cn.wps.moffice.define.VersionManager; import cn.wps.moffice_eng.R; import com.mopub.mobileads.VastExtensionXmlManager; import com.mopub.mobileads.VastIconXmlManager; import com.mopub.nativeads.AdResponseWrapper; import java.util.HashMap; public class PopUpTranslucentAciivity extends OnResultActivity { protected MaterialProgressBarCycle dXF; private WebView frG; private String hRl; private long hRm; private long hRn = -1; private boolean hRo = false; private boolean hRp = false; private PushBean hsS; private WebviewErrorPage mErrorView; public void bTs() { } public void onBackPressed() { if (this.frG.canGoBack()) { this.frG.goBack(); return; } super.onBackPressed(); if ("home_docs_ad".equals(getIntent().getStringExtra("ad_type"))) { fzc.bJM().a(fzd.home_docs_ad_show_by_popupwebview, new Object[0]); } } /* access modifiers changed from: protected */ @Override // cn.wps.moffice.common.beans.OnResultActivity public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(LayoutInflater.from(this).inflate(R.layout.phone_public_push_pop_translucent_view, (ViewGroup) null)); if (luf.gR(this) && luf.gS(this)) { luf.bG(this); luf.bA(this); } this.frG = (WebView) findViewById(R.id.public_common_push_pop_webview); this.mErrorView = (WebviewErrorPage) findViewById(R.id.error_page); this.dXF = (MaterialProgressBarCycle) findViewById(R.id.public_frequent_circle_progressBar); try { ebj.c(this.frG); this.frG.setBackgroundColor(0); this.frG.getBackground().setAlpha(0); int i = Build.VERSION.SDK_INT; if (i > 11 && i <= 15) { this.frG.setLayerType(1, null); } AnonymousClass1 r0 = new KWebChromeClient(this) { /* class cn.wps.moffice.main.push.common.PopUpTranslucentAciivity.AnonymousClass1 */ public final void onProgressChanged(WebView webView, int i) { if (i > 60 && PopUpTranslucentAciivity.this.dXF.getVisibility() == 0) { PopUpTranslucentAciivity.this.dXF.setVisibility(8); } super.onProgressChanged(webView, i); } }; this.frG.setWebChromeClient(r0); setOnHandleActivityResultListener(r0); this.frG.setWebViewClient(new WebViewClient() { /* class cn.wps.moffice.main.push.common.PopUpTranslucentAciivity.AnonymousClass2 */ public final void onPageFinished(WebView webView, String str) { super.onPageFinished(webView, str); PopUpTranslucentAciivity.this.mErrorView.aUU(); if (!PopUpTranslucentAciivity.this.hRo && "onPageStarted".equals(PopUpTranslucentAciivity.this.hRl)) { PopUpTranslucentAciivity.this.hRo = true; PopUpTranslucentAciivity.this.hRl = "onPageFinished"; PopUpTranslucentAciivity.this.hRn = System.currentTimeMillis() - PopUpTranslucentAciivity.this.hRm; } } public final void onPageStarted(WebView webView, String str, Bitmap bitmap) { super.onPageStarted(webView, str, bitmap); if (TextUtils.isEmpty(PopUpTranslucentAciivity.this.hRl)) { PopUpTranslucentAciivity.this.hRl = "onPageStarted"; PopUpTranslucentAciivity.this.hRm = System.currentTimeMillis(); } } public final void onReceivedError(WebView webView, int i, String str, String str2) { try { if (!PopUpTranslucentAciivity.this.hRo) { PopUpTranslucentAciivity.this.hRl = "onReceivedError"; } super.onReceivedError(webView, i, str, str2); ebj.f(i, str, str2); PopUpTranslucentAciivity.this.dXF.setVisibility(8); PopUpTranslucentAciivity.this.frG.setVisibility(8); PopUpTranslucentAciivity.this.findViewById(R.id.public_common_push_pop_content_view).setBackgroundColor(PopUpTranslucentAciivity.this.getResources().getColor(R.color.color_white)); PopUpTranslucentAciivity.this.mErrorView.f(PopUpTranslucentAciivity.this.frG).setVisibility(0); PopUpTranslucentAciivity.this.mErrorView.cNE.setText(R.string.documentmanager_cloudfile_no_network); View findViewById = PopUpTranslucentAciivity.this.findViewById(R.id.public_return_ad_close_parent); findViewById.setVisibility(0); findViewById.setOnClickListener(new View.OnClickListener() { /* class cn.wps.moffice.main.push.common.PopUpTranslucentAciivity.AnonymousClass2.AnonymousClass1 */ public final void onClick(View view) { PopUpTranslucentAciivity.this.finish(); } }); ((ImageView) PopUpTranslucentAciivity.this.findViewById(R.id.public_return_ad_close)).setBackgroundColor(PopUpTranslucentAciivity.this.mErrorView.getContext().getResources().getColor(R.color.color_icon_gray)); if (!hai.dS(PopUpTranslucentAciivity.this.mErrorView.getContext())) { PopUpTranslucentAciivity.this.mErrorView.cNE.setText(R.string.documentmanager_cloudfile_no_network); } else { PopUpTranslucentAciivity.this.mErrorView.cNE.setText(PopUpTranslucentAciivity.this.mErrorView.getContext().getResources().getString(R.string.public_error_content)); } PopUpTranslucentAciivity.this.bTs(); } catch (Resources.NotFoundException e) { e.printStackTrace(); PopUpTranslucentAciivity.this.bTs(); } catch (Throwable th) { PopUpTranslucentAciivity.this.bTs(); throw th; } } public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) { if (OfficeApp.arx().arB().equals("Inner001") || OfficeApp.arx().arB().equals("cninner001") || VersionManager.aYi()) { sslErrorHandler.proceed(); } else { super.onReceivedSslError(webView, sslErrorHandler, sslError); } } @Override // android.webkit.WebViewClient public final boolean shouldOverrideUrlLoading(WebView webView, String str) { try { if (str.startsWith("mailto:")) { Intent intent = new Intent("android.intent.action.SENDTO"); intent.setData(Uri.parse(str)); webView.getContext().startActivity(intent); return true; } else if (str.equals("http://wps.com/pc.install/") || str.equals("https://wps.com/pc.install/")) { PopUpTranslucentAciivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str))); return true; } else if (str.toLowerCase().startsWith("http:") || str.toLowerCase().startsWith("https:")) { return false; } else { if (hfj.bs(PopUpTranslucentAciivity.this, str)) { return true; } if (PopUpTranslucentAciivity.this.hsS != null && PopUpTranslucentAciivity.this.hsS.remark != null && PopUpTranslucentAciivity.this.hsS.remark.allow_jump_to_app != 1) { return true; } PopUpTranslucentAciivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str))); if (PopUpTranslucentAciivity.this.hRo) { return true; } PopUpTranslucentAciivity.this.hRl = "shouldOverrideUrlLoading Intent.ACTION_VIEW"; return true; } } catch (Exception e) { e.printStackTrace(); return true; } } }); this.frG.setDownloadListener(new DownloadListener() { /* class cn.wps.moffice.main.push.common.PopUpTranslucentAciivity.AnonymousClass3 */ public final void onDownloadStart(String str, String str2, String str3, String str4, long j) { try { if (PopUpTranslucentAciivity.this.hsS.remark.allow_download == 1) { hdy.bl(PopUpTranslucentAciivity.this.frG.getContext(), str); } } catch (Exception e) { } } }); this.frG.setOnLongClickListener(new View.OnLongClickListener() { /* class cn.wps.moffice.main.push.common.PopUpTranslucentAciivity.AnonymousClass4 */ public final boolean onLongClick(View view) { return true; } }); JSCustomInvoke jSCustomInvoke = new JSCustomInvoke(); jSCustomInvoke.setJsCallback(new hac(this, this.frG, this.dXF)); this.frG.addJavascriptInterface(jSCustomInvoke, "splash"); } catch (Exception e) { e.printStackTrace(); } this.hsS = (PushBean) getIntent().getSerializableExtra("EXPLORE_PUSH_KEY"); if (this.hsS != null) { ebj.mK(this.hsS.remark.netUrl); this.frG.loadUrl(this.hsS.remark.netUrl); return; } String stringExtra = getIntent().getStringExtra(hbe.frL); if (!TextUtils.isEmpty(stringExtra)) { ebj.mK(stringExtra); this.frG.loadUrl(stringExtra); return; } finish(); } /* access modifiers changed from: protected */ @Override // cn.wps.moffice.common.beans.OnResultActivity public void onDestroy() { super.onDestroy(); ebj.d(this.frG); } /* access modifiers changed from: protected */ public void onPause() { super.onPause(); this.frG.onPause(); String stringExtra = getIntent().getStringExtra(AdResponseWrapper.KEY_PLACEMENT); if (!TextUtils.isEmpty(stringExtra) && !this.hRp) { if (this.hRo) { this.hRp = true; } HashMap hashMap = new HashMap(); hashMap.put(AdResponseWrapper.KEY_PLACEMENT, stringExtra); hashMap.put("ad_title", getIntent().getStringExtra(hbe.KEY_TITLE)); hashMap.put(VastExtensionXmlManager.TYPE, "popwebview"); hashMap.put(NotificationCompat.CATEGORY_STATUS, this.hRl); hashMap.put(VastIconXmlManager.DURATION, String.valueOf(this.hRo ? this.hRn : System.currentTimeMillis() - this.hRm)); hashMap.put("ad_from", getIntent().getStringExtra("ad_from")); dwp.l("op_ad_webview_arrived", hashMap); } } @Override // cn.wps.moffice.common.beans.OnResultActivity public void onResume() { dwp.km("operation_float_window_pageview"); super.onResume(); this.frG.onResume(); } }